#include <iostream>
#include <future>
#include <thread>
#include <chrono>

int Add(int nums1, int nums2)
{
    std::cout << "into add" << std::endl;
    return nums1 + nums2;
}

int main()
{

    std::promise<int> pro;

    std::future<int> res = pro.get_future();

    std::thread thr([&pro]()
                    { int sum = Add(10, 20);
                    pro.set_value(sum); });

    std::cout << res.get() << std::endl;
    thr.join();
    return 0;
}
